'use strict';
function updateURLParameter(url, param1, paramVal1,param2,paramVal2,param3,paramVal3){
    var newAdditionalURL = "";
    var tempArray = url.split("?");
    var additionalURL = tempArray[1];
    var temp = "";
    if (additionalURL) {
        tempArray = additionalURL.split("&");
        for (var i=0; i<tempArray.length; i++){
            if(tempArray[i].split('=')[0] != param1 && tempArray[i].split('=')[0] != param2 && tempArray[i].split('=')[0] != param3){
                newAdditionalURL += temp + tempArray[i];
                temp = "&";
            }else if(tempArray[i].split('=')[0] == param1) {
                newAdditionalURL += "&" + param1 + "=" + paramVal1;
            }else if(tempArray[i].split('=')[0] == param2){
                newAdditionalURL += "&" + param2 + "=" + paramVal2;
            }else if(tempArray[i].split('=')[0] == param3){
                newAdditionalURL += "&" + param3 + "=" + paramVal3;
            }
        }
    }

    var host = 'http://'+'127.0.0.1:8080'+''
    return host + "?" + newAdditionalURL ;
}

var iframe = window.top.document.getElementsByTagName("iframe");

for(var i=0;i<iframe.length;i++){
    var url = iframe[i].src;
    iframe[i].src = updateURLParameter(iframe[i].src,'full','1','addons','0','stories','0');
}
